Str Function
Returns the String form of the value passed.
Syntax
result = Str( number )
Parameters | ||
number |
Integer, |
Any numeric expression. |
Notes
Use the Format function when you want to convert numeric values into formatted strings such as dates, times, currency etc.
Str returns seven (7) significant digits. It uses scientific notation when it needs to return more than 6 digits. Str(123456789) returns 1.234568e+8.
Str assumes the period (.) is the decimal separator. If your application needs to recognize other decimal separators, use the CStr function.
Examples
This example uses the Str function to return the String form of several numbers.
Dim s As String
s=Str (123) //returns "123"
s=Str(-123.44) //returns "-123.44"
s=Str(123.0045) //returns "123.0045"
Const Pi=3.14159265358979323846264338327950
s= Str(pi) // returns "3.141593"
s=Str (123) //returns "123"
s=Str(-123.44) //returns "-123.44"
s=Str(123.0045) //returns "123.0045"
Const Pi=3.14159265358979323846264338327950
s= Str(pi) // returns "3.141593"
See Also